package com.datalayer.orm;

import com.container.app.annotations.Component;

import java.lang.annotation.AnnotationTypeMismatchException;
import java.lang.annotation.IncompleteAnnotationException;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * Created with IntelliJ IDEA.
 * User: Georgiana.Scarlat
 * Date: 7/9/12
 * Time: 6:42 PM
 */
@Component
public interface ORM {

    public Connection initConnection(String url, String userName, String pass) throws IllegalArgumentException;

    public void closeConnection() throws SQLException;

    public <T> void removeObjectFromDB(T object) throws SQLException, AnnotationTypeMismatchException, IncompleteAnnotationException, UnsupportedOperationException;

    public void removeEntityFromDB(Class entityClass) throws SQLException , UnsupportedOperationException, AnnotationTypeMismatchException, IncompleteAnnotationException;

    public void createTableFromEntity(Class entityClass) throws SQLException, AnnotationTypeMismatchException, IncompleteAnnotationException;

    public <T> void insertObject2DB(T object) throws SQLException, AnnotationTypeMismatchException, UnsupportedOperationException, IncompleteAnnotationException;

    public MyQuery makeQuery(String query);

    public void createTableIfDoesNotExist(Class entityClass) throws SQLException, IncompleteAnnotationException;
}
